-
-
Notifications
You must be signed in to change notification settings - Fork 111
Fix #4715: Propagate CancellationToken through property injection to prevent hangs #4732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t hangs (#4715) When IAsyncInitializer.InitializeAsync() hangs during property injection in a chained ClassDataSource dependency pattern, the test runner stalls indefinitely because CancellationToken.None is passed through the entire property injection chain. This threads the 5-minute discovery timeout CancellationToken from TestDiscoveryService through PropertyInjector, ObjectLifecycleService, TestBuilder, and TestArgumentRegistrationService so that EnsureInitializedAsync can be cancelled when the timeout fires. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. This PR implements a clean solution to the hang issue by threading the cancellation token through the entire property injection chain. The changes are:
The architecture properly leverages .NET's cancellation infrastructure to unblock waiting tests when initialization fails or times out, converting an indefinite hang into a graceful failure with OperationCanceledException. |
Summary
CancellationTokenfromTestDiscoveryService.DiscoverTestsStreamAsyncthrough the entire property injection chain:TestBuilderPipeline→TestBuilder→ObjectLifecycleService→PropertyInjector→EnsureInitializedAsyncIAsyncInitializer.InitializeAsync()hangs during property injection in a chainedClassDataSourcedependency pattern, the timeout now fires and unblocks all waiters viaOperationCanceledException